#ifndef GAMEAPP_H__
#define GAMEAPP_H__

#include "Common/CommonTypes.h"
#include "Utility/GameTimer.h"

class CEngine;
class CGameWorld;

class GameApp
{
public:
	explicit GameApp(HINSTANCE hInstance);
	virtual ~GameApp();

	bool      Init();

	HINSTANCE GetAppInstance();
	HWND      GetMainWindow();

	LRESULT   WinProc(UINT32 msg, WPARAM wParam, LPARAM lParam);
	INT32     Run();
	
public:
	bool      OnInit();
	void      OnUpdate(float fTimeElapsed);
	void      OnRender();

	CEngine*            GetEngine()       { return m_pEngine;       }
	CGameWorld*         GetGameWorld()    { return m_pGameWorld;    }
	const GameTimer&    GetGameTimer()    { return m_oTimer;        }
	std::wstring        GetResourcePath() { return L"Resource\\";   }

private:
	void     _InitMainWindow();
	void     _CalculateStats();
	void     _DisplayStats();

private:
	HINSTANCE   m_hInstance;
	HWND        m_hMainWnd;
	bool        m_bAppPause;
	bool        m_bMinimized;
	bool        m_bMaximized;
	bool        m_bResizing;

	std::wstring          m_wstrWinCaption;
		
	GameTimer             m_oTimer;
	std::wstring          m_wstrFrameStats;

private:
	CEngine*              m_pEngine;
	CGameWorld*           m_pGameWorld;
};

GameApp* GetApp();

LRESULT CALLBACK WinProc(HWND hWnd, UINT32 msg, WPARAM wParam, LPARAM lParam);


#endif // GAMEAPP_H__
